import request from '@/utils/request';

export async function getNotifyTemplateInfoByPage (params: any) {
    return request('/api/service/getNotifyTemplateInfoByPage', {
    method: 'POST',
    data: params,
  });
}

export async function addNotifyTemplateInfo (params: any) {
    return request('/api/service/addNotifyTemplateInfo', {
    method: 'POST',
    data: params,
  });
}

export async function updateNotifyTemplateInfo (params: any) {
    return request('/api/service/updateNotifyTemplateInfo', {
    method: 'POST',
    data: params,
  });
}

// 分页查询
export async function getNotifyInfoTotalByPage (params: any) {
  return request('/api/service/getNotifyInfoTotalByPage', {
  method: 'POST',
  data: params,
});
}

// 删除
export async function delNotifyTemplateInfo (para: any) {
    return request('/api/service/delNotifyTemplateInfo', {
    method: 'POST',
    params:{
      notifyTemplateInfoId: para.notifyTemplateInfoId,
    }
  });
}

export async function exportNotifyTemplateInfo(params: any) {
    return request('/api/service/exportNotifyTemplateInfo', {
    method: 'POST',
    data: params,
    responseType: 'blob',
  });
}

// 已读（单个/批量）
export async function readOneOrManyOrAllNotify (para: any) {
  return request('/api/service/readOneOrManyOrAllNotify', {
  method: 'POST',
  params:{
    notifyTemplateInfoIdList: para.notifyTemplateInfoIdList,
    notifyType: para.notifyType,
    status: para.status,
    userName: para.userName,
  }
});
}

// 清空已读/已办
export async function delNotifyTemplateInfos (para: any) {
  return request('/api/service/delNotifyTemplateInfos', {
  method: 'POST',
  params:{
    status: para.status,
    userName: para.userName,
  }
});
}

// 获取当前用户名
export async function viewBaseInfo(params: any) {
  return request('/api/user/viewBaseInfo', {
    method: 'POST',
    data: params,
  });
}

// 已读全部
export async function readAllNotify (para: any) {
  return request('/api/service/readAllNotify', {
  method: 'POST',
  params:{
    notifyType: para.notifyType,
    status: para.status,
    userName: para.userName,
  }
});
}
export default { getNotifyTemplateInfoByPage, addNotifyTemplateInfo, updateNotifyTemplateInfo, delNotifyTemplateInfo, exportNotifyTemplateInfo }
